{{ resource('css', '50')|raw }}
{{ resource('js', '5,50,2,3,104')|raw }}
<script>
var map = {
    dry: '{/}/layuiadmin/modules/dry',
    file: '{/}/layuiadmin/modules/file',
    cookies: '{/}/layuiadmin/modules/cookies'
};
layui.config({base: '/layuiadmin/', version: CSS_JS_VERSION}).extend(map);

layui.use(["jquery", "element"], function($, element){
    $(".layui-logo a").click(function(){
        var data = $(this).attr("data");
        if(data == "1"){
            $(this).attr("data", "0");
            $(".layui-side").hide();
            $(".layui-body").css("left", 0);
            $(".layui-footer").css("left", 0);
        }
        else {
            $(this).attr("data", "1");
            $(".layui-side").show();
            $(".layui-body").css("left", 200);
            $(".layui-footer").css("left", 200);
        }
    });
    /**/
    $("body").on("click", "#LAY-system-side-menu dl dd a", function(e){
        var title = $(e.target).html();
        var src = $(e.target).attr("lay-href");
        if($(`iframe[src='${src}']`).length == 0){
            var content = `<iframe src="${src}" frameborder="0" scrolling="auto" width="100%" height="100%" style="position:absolute;"></iframe>`;
            element.tabAdd('demo', {title: title, content: content, id: src});
        }
        element.tabChange('demo', src);
    });
    /**/
    $(".close-tab").click(function(){
        if($(".layui-tab-item.layui-show iframe").length == 0){
            return false;
        }
        var data = $(this).attr("data");
        var current = $(".layui-tab-item.layui-show iframe").attr("src");
        if(data == "current"){
            element.tabDelete('demo', current);
            return true;
        }
        $(".layui-tab-item iframe").each(function(){
            var src = $(this).attr("src");
            if(data == "other"){
                if(src != current){
                    element.tabDelete('demo', src);
                }
            }
            else if(data == "all"){
                element.tabDelete('demo', src);
            }
        });
    });
    /**/
    $("#refresh").click(function(){
        if($(".layui-tab-item.layui-show iframe").length == 0){
            return false;
        }
        $(".layui-tab-item.layui-show iframe").get(0).contentWindow.location.reload();
    });
    /**/
});
</script>
<style>
.layui-logo {
    user-select: none;
}
.layui-logo a {
    color: #009688;
}
.layui-icon {
    margin-right: 10px;
}
.layui-tab {
    margin: 0;
}
.layui-body {
    overflow-y: hidden;
}
.layui-tab-title .layui-this {
    color: #009688;
}
.layui-tab-title li {
    user-select: none;
}
</style>